package Review;

class Stu2{
    public int id;
    public String name;
    public Stu2(){
        id = 1;
        name = "叶良辰";
    }

    @Override
    public String toString() {
        return "Stu{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }
}
class Stu3{
    int id;
    String name;
}
public class Reflect {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        Stu2 stu = new Stu2();
        Class<?> c1 = stu.getClass();
//        Class<?> c2 = Stu2.class;
//        Class<?> c3 = Class.forName("Review.Stu2");
        Stu3 stu3 = (Stu3) c1.newInstance();
        System.out.println(stu3.toString());
    }
}
